package com.zygame.sdk.bean;

import java.util.ArrayList;

import android.os.Parcel;
import android.os.Parcelable;

public class Main extends ConfigData implements Parcelable{
	
	public ArrayList<Submenu> submenus;
	public ArrayList<Navibutton> navibuttons;
	
	public Main(){
		super();  
	}
	
	public Main(String id,String pid,String name,String action,String src,String type,String auth,String url,
			String pos,String toolbar,String hide,String seq,String status,ArrayList<Submenu> submenus,ArrayList<Navibutton> navibuttons){
		super(id, pid, name, action, src, type, auth, url, pos, toolbar,hide,seq,status, submenus, navibuttons);
		this.submenus = submenus;
		this.navibuttons = navibuttons;
	}

	
	@Override
	public int describeContents() {
		return 0;
	}
	@Override
	public void writeToParcel(Parcel dest, int flags) {
		//		读和写的顺序要一致
		dest.writeString(id);
		dest.writeString(pid);
		dest.writeString(name);
		dest.writeString(action);
		dest.writeString(src);
		dest.writeString(type);
		dest.writeString(url);
		dest.writeString(pos);
		dest.writeString(toolbar);
		dest.writeString(seq);
		dest.writeString(status);
		dest.writeList(submenus);
		dest.writeList(navibuttons);
		
	}
	
	public Main(Parcel parcel){
		//		读和写的顺序要一致
		id = parcel.readString();
		pid = parcel.readString();
		name = parcel.readString();
		action = parcel.readString();
		src = parcel.readString();
		type = parcel.readString();
		url = parcel.readString();
		pos = parcel.readString();
		toolbar = parcel.readString();
		seq = parcel.readString();
		status = parcel.readString();
		this.submenus = new ArrayList<Submenu>();
		this.navibuttons = new ArrayList<Navibutton>(); 
		parcel.readList(submenus, getClass().getClassLoader());
		parcel.readList(navibuttons, getClass().getClassLoader());
	}
	
	public static final Parcelable.Creator<Main> CREATOR = new Creator<Main>() {

		@Override
		public Main createFromParcel(Parcel source) {
			return new Main(source);
		}

		@Override
		public Main[] newArray(int size) {
			return new Main[size];
		}
	};
}
